//
//  FKOrderListHeader.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/22.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKOrderListHeader.h"
#import "FKOrder.h"


@interface FKOrderListHeader ()

@property (nonatomic, weak) UILabel *orderSnLabel;
@property (nonatomic, weak) UILabel *statusLabel;

@end

@implementation FKOrderListHeader

- (void)setupSubviews
{
    [super setupSubviews];
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    UIView *separator = [[UIView alloc] init];
    [self.contentView addSubview:separator];
    separator.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    UILabel *orderSnLabel = [UILabel fk_labelWithFont:fk_adjustFont(17) textColor:fkColor999999];
    [self.contentView addSubview:orderSnLabel];
    self.orderSnLabel = orderSnLabel;
    orderSnLabel.numberOfLines = 2;
    
    UILabel *statusLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkMainColor];
    [self.contentView addSubview:statusLabel];
    self.statusLabel = statusLabel;
    
    UIView *separator1 = [[UIView alloc] init];
    [self.contentView addSubview:separator1];
    separator1.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    [separator mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.offset(0);
        make.height.offset(fk_adjustW(10));
    }];
    [orderSnLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.top.equalTo(separator.mas_bottom);
        make.bottom.offset(0);
    }];
    [statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-12);
        make.centerY.equalTo(orderSnLabel);
    }];
    [separator1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.offset(0);
        make.height.offset(0.8);
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    FKOrder *order = (FKOrder *)data;
    self.orderSnLabel.text = order.orderSnText;
    self.statusLabel.text = order.status_name;
}

@end
